import {Routes,Route} from 'react-router-dom'
import Author from './Author'
import element from './element'
export default function RouterViews(){
    return(
        <div>
          <Routes>
            {
                element.map((item,index)=>{
                    return <Route key={index} path={item.path} element={item.author?<Author oldComponent={item.element} oldPath={item.path}></Author>:item.element}>
                      {
                        item.children && item.children.map((child,i)=>{
                          return (
                            <Route key={i} path={child.path} element={child.author?<Author oldComponent={child.element} oldPath={item.path+"/"+child.path}></Author>:child.element}></Route>
                          )
                        })
                      }
                    </Route>
                })
            }
          </Routes>
        </div>
    )
}
